package artid.com.arttogoa;


import artid.com.arttogoa.app.ArtWorkApp;
import artid.com.arttogoa.util.ToastUtil;
import com.umeng.analytics.MobclickAgent;
import com.umeng.message.PushAgent;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

/**
 * 
 * 
 * 项目名称：ArtworkArtA 类名称：BaseActivity 类描述：Activity基础类 创建人：耿卫斌 创建时间：2016年5月16日
 * 下午1:29:14
 * 
 */
public class BaseActivity extends FragmentActivity {
	public ImageView mBack, mReleaseIcon;
	public TextView mTittle, mTittleRight, mFbText;
	public RelativeLayout loading;
	public LinearLayout hint;
	public ImageView rightMenu;
	public Context mContext;
	private int version;
	public  AlertDialog alertDialog;
	View back;

	/*
	 * (non-Javadoc)~~~~~
	 * 
	 * @see android.support.v7.app.AppCompatActivity#onCreate(android.os.Bundle)
	 */
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		version = Integer.valueOf(android.os.Build.VERSION.SDK);
		PushAgent.getInstance(mContext).onAppStart();
	}

	/**
	 * @param mainActivity
	 */
	public void setContent(Activity activity, Intent intent) {
		mContext = activity;
		ArtWorkApp.currentActivity=activity;
		mTittle = (TextView) activity.findViewById(R.id.title_text);
		mBack = (ImageView) activity.findViewById(R.id.back_btn);
		rightMenu = (ImageView) activity.findViewById(R.id.title_menu);
	}

	protected void setBack(){
		back = (View)findViewById(R.id.rela_back);
		back.setOnClickListener(new OnClickListener() {
			
			@Override 
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				finish();
			}
		});
	}
	public void showToast(String message) {
		ToastUtil.toast(mContext, message);
	}

	public void Intent(Context packageContext, Class<?> cls, Bundle bundle) {

		Intent intent = new Intent(packageContext, cls);
		intent.putExtras(bundle);
		packageContext.startActivity(intent);
		// if (version > 5) {
		// overridePendingTransition(R.anim.zoomin, R.anim.zoomout);
		// }
	}

	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		super.onResume();
		MobclickAgent.onResume(this);
	}

	@Override
	protected void onPause() {
		// TODO Auto-generated method stub
		super.onPause();
		MobclickAgent.onPause(this);
	}

}